package com.limf.demo.java8;

import java.util.Comparator;

public class ComparatorTest {

	static void comparatorTest() {
		Comparator<Person> comparator = (p1, p2)->p1.firstName.compareTo(p2.firstName);
		Person p1 = new Person("JohA", "Doe");
		Person p2 = new Person("AlicJ", "Wonderland");
		System.out.println(comparator.compare(p1,  p2));
		System.out.println(comparator.reversed().compare(p1, p2));
	}
	public static void main(String[] args) {
		comparatorTest();
	}
	
}
